<div class="member-main member-main2">
<div class="page-article">
<{if count($recommend_goods) > 0}>
    <form id="order-recommend-goods-form" action="<{link app=b2c ctl=site_member act=do_recommend full=1}>" method="post">
	    <input type="hidden" name="obj_id" value="<{$obj_id}>">
		<table class="member-grid" style="text-align:center">
		    <tr>
				<td colspan="5" style="padding-left:8px; padding-right:8px;">
					<span class="recommend-confirm">
						<button type="submit"   onclick="javascript:(0);" rel="_request" class="btn btn-import"><span><span><{t}>确认<{/t}></span></span></button>
					</span>
				</td>
			</tr>
			<tr>
			    <td width="10%">&nbsp;</td>
				<td width="40%"><{t}>商品名称<{/t}></td>
				<td width="23%"><{t}>商品编号<{/t}></td>
				<td width="15%"><{t}>采购价<{/t}></td>
				<td width="12%"><{t}>库存<{/t}></td>
			</tr>
		  <!--以下部分为一个循环-->
			<{foreach from=$recommend_goods key=key item=item}>
			 <tbody>
				<tr>
					<td colspan="5" style="height:8px;"></td>
				</tr>
				<tr>
					<td colspan="2" style="padding-left:8px;text-align:left"><input name="is_selected" type="radio" value="<{$item.goods_id}>" class="ck-grey" id="<{$key}>_s"><label for="<{$key}>_s"><{$item.name}></label></td>
					<td><b><{$item.products.0.bn}></b></td>
					<td><b><{$item.price*(1-$item.brand.rebate/100)|cur}></b></td>
					<td><b><{$item.products.0.store - $item.products.0.freez}></b></td>
				</tr>
			</tbody>
			<tr>
				<td colspan="5" style="height:1px;background:#ebebeb;"></td>
			</tr>
			</tbody>
			<{/foreach}>
		</table>
	</form>
<{else}>
    <{t}>暂无数据<{/t}>
<{/if}>
</div>
</div>

<script>
//没有选择商品时，按钮为灰色
$$('#order-recommend-goods-form .ck-grey').addEvent('click',function(e){
	if(show().length == 0){
		no_selected();
	}else{
		has_selected();
	}
});

//选中商品的状态为黄色
function has_selected(){
	ul = '<button type="submit"   onclick="javascript:(0);" rel="_request"  class="btn btn-import"><span><span><{t}>确认<{/t}></span></span></button>';
	$$('#order-recommend-goods-form .recommend-confirm').set('html',ul);
}

//不选中时为灰色
function no_selected(){
	ul = '<button type="submit"   onclick="javascript:(0);" rel="_request"  class="btn btn-import"><span><span><{t}>确认<{/t}></span></span></button>';
	$$('#order-recommend-goods-form .recommend-confirm').set('html',ul);
}

//获取选中商品
function show(){
	var cSelected = document.getElementsByName("is_selected");
	var idents = new Array();
	for(i = 0;i < cSelected.length;i++){
		if(cSelected[i].checked){
			idents.push(cSelected[i].checked);
		}
	}
	return idents;
}
</script>